#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> cnt[100005];
int main()
{
	int n; cin >> n;
	vector<int>arr(n);
	for (int i = 0; i < n; i++) cin >> arr[i];
	sort(arr.begin(), arr.end());
	for(int i =0;i<n;i++)
	{
		for(int j = 1;j<=arr[i]/j;j++)
		{
			if(arr[i]%j==0)
			{
				cnt[j].push_back(arr[i]);
				if(arr[i]/j!=j)
				{
					cnt[arr[i]/j].push_back(arr[i]);
				}
			}
		}
	}
	for(int i = 100000;i>=1;i--)
	{
		if(cnt[i].size()>=3)
		{
			for(int j =0;j<3;j++)
			{
				cout<<cnt[i][j]<<" ";
			}
			break;
		}
	}
	return 0;
}
